﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using cecbData;
using cecbClasses.Data_Classes;

namespace cecbClasses
{
    public class DataAdapter
    {
        
        private DSSEntities dataContext;

        public DataAdapter() 
        {
            dataContext = new DSSEntities();
        }

        public DataAdapter(String arg)
        {
        
        }
        
        //---------------------------------insert methods--------------------------------------------------------

        public Boolean insertIntoActivities(Data_Activities arg)
        {
            Boolean isInserted = false;

            try
            {
                Activities act = new Activities();
                act.actv_name = arg.actv_name;
                act.actv_phase = arg.Actv_phase;
                act.actv_reference = arg.Actv_reference;
                act.actv_status = arg.Actv_status;

                dataContext.AddToActivities(act);
                dataContext.SaveChanges();

                isInserted = true;
            }
            catch (Exception)
            {
               
                throw;
            }

            return isInserted;
        }

        public Boolean insertIntoCategories(Data_Categories arg)
        {
            Boolean isInserted = false;

            try
            {
                Categories cat = new Categories();
                cat.cat_name = arg.Cat_name;
                cat.cat_reference = arg.Cat_reference;
                cat.cat_status = arg.Cat_status;

                dataContext.AddToCategories(cat);
                dataContext.SaveChanges();

                isInserted = true;
            }
            catch (Exception)
            {

                throw;
            }

            return isInserted;
        }

        public Boolean insertIntoComponents(Data_Components arg)
        {
            Boolean isInserted = false;

            try
            {
                Components com = new Components();
                com.cmpt_mainCat = arg.Cmpt_mainCat;
                com.cmpt_name = arg.Cmpt_name;
                com.cmpt_reference = arg.Cmpt_reference;
                com.cmpt_status = arg.Cmpt_status;

                dataContext.AddToComponents(com);
                dataContext.SaveChanges();

                isInserted = true;
            }
            catch (Exception)
            {

                throw;
            }

            return isInserted;
        }

        public Boolean insertIntoImpacts(Data_Impacts arg)
        {
            Boolean isInserted = false;

            try
            {
                Impacts imp = new Impacts();
                imp.impt_component = arg.Impt_component;
                imp.impt_name = arg.Impt_name;
                imp.impt_reference = arg.Impt_referenrce;
                imp.impt_status = arg.Impt_status;

                dataContext.AddToImpacts(imp);
                dataContext.SaveChanges();

                isInserted = true;
            }
            catch (Exception)
            {

                throw;
            }

            return isInserted;
        }
       
        public Boolean insertIntoLeopoldMatrixValues(Data_LeopoldMatrixValues arg)
        {
            Boolean isInserted = false;

            try
            {
                LeopoldMatrixValues leo = new LeopoldMatrixValues();
                leo.actv_reference = arg.Actv_reference;
                leo.impt_reference = arg.Impt_reference;
                leo.mtrx_importance = arg.Mtrx_importance;
                leo.mtrx_importanceComment = arg.Mtrx_importanceComment;
                leo.mtrx_isRelated = arg.Mtrx_isRelated;
                leo.mtrx_magnitude = arg.Mtrx_magnitude;
                leo.mtrx_magnitudeComment = arg.Mtrx_magnitudeComment;
                leo.mtrx_status = arg.Mtrx_status;
                leo.proj_reference = arg.Proj_reference;

                dataContext.AddToLeopoldMatrixValues(leo);
                dataContext.SaveChanges();

                isInserted = true;
            }
            catch (Exception)
            {

                throw;
            }

            return isInserted;
        }

        public Boolean insertIntoMemberContacts(Data_MemberContacts arg)
        {
            Boolean isInserted = false;

            try
            {
                MemberContacts mem = new MemberContacts();
                mem.mem_contactNo = arg.Mem_contactNo;
                mem.mem_reference = arg.Mem_reference;

                dataContext.AddToMemberContacts(mem);
                dataContext.SaveChanges();

                isInserted = true;
            }
            catch (Exception)
            {

                throw;
            }

            return isInserted;
        }

        public Boolean insertIntoMemberEmails(Data_MemberEmails arg)
        {
            Boolean isInserted = false;

            try
            {
                MemberEmails mem = new MemberEmails();
                mem.mem_email = arg.Mem_email;
                mem.mem_reference = arg.Mem_reference;

                dataContext.AddToMemberEmails(mem);
                dataContext.SaveChanges();

                isInserted = true;
            }
            catch (Exception)
            {

                throw;
            }

            return isInserted;
        }

        public Boolean insertIntoMembers(Data_Members arg)
        {
            Boolean isInserted = false;

            try
            {
                Members mem = new Members();
                mem.mem_address = arg.Mem_address;
                mem.mem_areaOfSpec = arg.Mem_areaOfSpec;
                mem.mem_designation = arg.Mem_designation;
                mem.mem_experiences = arg.Mem_experiences;
                mem.mem_name = arg.Mem_name;
                mem.mem_qualifications = arg.Mem_qualifications;
                mem.mem_reference = arg.Mem_reference;
                mem.mem_status = arg.Mem_status;

                dataContext.AddToMembers(mem);
                dataContext.SaveChanges();

                isInserted = true;
            }
            catch (Exception)
            {

                throw;
            }

            return isInserted;
        }

        public Boolean insertIntoLogin(Data_Login arg)
        {
            Boolean isInserted = false;

            try
            {
                MemberLogin log = new MemberLogin();
                log.login_isApproved = arg.Login_isApproved;
                log.login_password = arg.Login_password;
                log.login_username = arg.Login_username;
                log.mem_reference = arg.Mem_reference;

                dataContext.AddToMemberLogin(log);
                dataContext.SaveChanges();

                isInserted = true;
            }
            catch (Exception)
            {

                throw;
            }

            return isInserted;
        }

        public Boolean insertIntoProjectActivities(Data_ProjectActivities arg)
        {
            Boolean isInserted = false;

            try
            {
                ProjectActivities act = new ProjectActivities();
                act.actv_addedBy = arg.Actv_addedBy;
                act.actv_approvedBy = arg.Actv_approrvedBy;
                act.actv_reference = arg.Actv_reference;
                act.proj_reference = arg.Proj_reference;
                act.proActiv_status = arg.ProActiv_status;

                dataContext.AddToProjectActivities(act);
                dataContext.SaveChanges();

                isInserted = true;
            }
            catch (Exception)
            {

                throw;
            }

            return isInserted;
        }

        public Boolean insertIntoProjectCriteria(Data_ProjectCriterias arg)
        {
            Boolean isInserted = false;

            try
            {
                ProjectCriteria crt = new ProjectCriteria();
                crt.crt_range = arg.Crt_range;
                crt.crt_type = arg.Crt_type;
                crt.proj_matrix = arg.Proj_matrix;
                crt.proj_reference = arg.Proj_reference;

                dataContext.AddToProjectCriteria(crt);
                dataContext.SaveChanges();

                isInserted = true;
            }
            catch (Exception)
            {

                throw;
            }

            return isInserted;
        }

        public Boolean insertIntoProjectGridLocation(Data_ProjectGridLocation arg)
        {
            Boolean isInserted = false;

            try
            {
                ProjectGridLocation grd = new ProjectGridLocation();
               // grd.loc_latitude = arg.Loc_latitude;
               // grd.loc_longitude = arg.Loc_longitude;
                grd.proj_reference = arg.Proj_reference;

                dataContext.AddToProjectGridLocation(grd);
                dataContext.SaveChanges();

                isInserted = true;
            }
            catch (Exception)
            {

                throw;
            }

            return isInserted;
        }

        public Boolean insertIntoProjectImpacts(Data_ProjectImpacts arg)
        {
            Boolean isInserted = false;

            try
            {
                ProjectImpacts imp = new ProjectImpacts();
                imp.impt_addedBy = arg.Impt_addedBy;
                imp.impt_approvedBy = arg.Impt_approvedBy;
                imp.impt_owner = arg.Impt_owner;
                imp.impt_reference = arg.Impt_reference;
                imp.proj_reference = arg.Proj_reference;
                imp.projImpact_status = arg.ProjImpact_status;

                dataContext.AddToProjectImpacts(imp);
                dataContext.SaveChanges();

                isInserted = true;
            }
            catch (Exception)
            {

                throw;
            }

            return isInserted;
        }

        public Boolean insertIntoProjects(Data_Projects arg)
        {
            Boolean isInserted = false;

            try
            {
                Projects pro = new Projects();
                pro.proj_approvingAgency = arg.Proj_approvingAgency;
                pro.proj_category = arg.Proj_category;
                pro.proj_consultant = arg.Proj_consultant;
                pro.proj_decisionComment = arg.Proj_decisionComment;
               // pro.proj_decisonUpDate = arg.Proj_decisonUpDate;
                pro.proj_finalDecision = arg.Proj_finalDecision;
                pro.proj_finalResult = arg.Proj_finalResult;
               // pro.proj_fromDate = arg.Proj_fromDate;
                pro.proj_location = arg.Proj_location;
                pro.proj_modelImage = arg.Proj_modelImage;
                pro.proj_name = arg.Proj_name;
                pro.proj_otherDetails = arg.Proj_otherDetails;
                pro.proj_planImage = arg.Proj_planImage;
                pro.proj_proponent = arg.Proj_proponent;
                pro.proj_reference = arg.Proj_reference;
                pro.proj_status = arg.Proj_status;
                //pro.proj_toDate = arg.Proj_toDate;
                pro.proj_type = arg.Proj_type;

                dataContext.AddToProjects(pro);
                dataContext.SaveChanges();

                isInserted = true;
            }
            catch (Exception)
            {

                throw;
            }

            return isInserted;
        }

        public Boolean insertIntoProjectTypes(Data_ProjectTypes arg)
        {
            Boolean isInserted = false;

            try
            {
                ProjectTypes typ = new ProjectTypes();
                typ.ptype_name = arg.Ptype_name;
                typ.ptype_reference = arg.Ptype_reference;
                typ.ptype_status = arg.Ptype_status;

                dataContext.AddToProjectTypes(typ);
                dataContext.SaveChanges();

                isInserted = true;
            }
            catch (Exception)
            {

                throw;
            }

            return isInserted;
        }

        public Boolean insertIntoSentMails(Data_SentEmails arg)
        {
            Boolean isInserted = false;

            try
            {
                SentEmails eml = new SentEmails();
                eml.eml_reciversEmail = arg.Eml_reciversEmail;
                eml.eml_recvdMember = arg.Eml_recvdMember;
                eml.eml_sendersEmail = arg.Eml_sendersEmail;
                eml.eml_sentDateTime = arg.Eml_sentDateTime;
                eml.eml_sentMember = arg.Eml_sentMember;
                eml.eml_status = arg.Eml_status;
                eml.proj_reference = arg.Proj_reference;

                dataContext.AddToSentEmails(eml);
                dataContext.SaveChanges();

                isInserted = true;
            }
            catch (Exception)
            {

                throw;
            }

            return isInserted;
        }

        public Boolean insertIntoSimpleMatrixValues(Data_SimpleMatrixValues arg)
        {
            Boolean isInserted = false;

            try
            {
                SimpleMatrixValues sim = new SimpleMatrixValues();
                sim.actv_reference = arg.Actv_reference;
                sim.impt_reference = arg.Impt_reference;
                sim.mtrx_comment = arg.Mtrx_comment;
                sim.mtrx_isRelated = arg.Mtrx_isRelated;
                sim.mtrx_status = arg.Mtrx_status;
                sim.mtrx_value = arg.Mtrx_value;
                sim.proj_reference = arg.Proj_reference;

                dataContext.AddToSimpleMatrixValues(sim);
                dataContext.SaveChanges();

                isInserted = true;
            }
            catch (Exception)
            {

                throw;
            }

            return isInserted;
        }

        public Boolean insertIntoTeamMembers(Data_TeamMembers arg)
        {
            Boolean isInserted = false;

            try
            {
                TeamMembers tem = new TeamMembers();
                tem.mem_reference = arg.Mem_reference;
                tem.team_reference = arg.Team_reference;
                tem.teamMem_status = arg.TeamMem_status;

                dataContext.AddToTeamMembers(tem);
                dataContext.SaveChanges();

                isInserted = true;
            }
            catch (Exception)
            {

                throw;
            }

            return isInserted;
        }

        public Boolean insertIntoTeams(Data_Teams arg)
        {
            Boolean isInserted = false;

            try
            {
                Teams tea = new Teams();
                tea.team_name = arg.Team_name;
                tea.team_reference = arg.Team_reference;
                tea.team_status = arg.Team_status;

                dataContext.AddToTeams(tea);
                dataContext.SaveChanges();

                isInserted = true;
            }
            catch (Exception)
            {

                throw;
            }

            return isInserted;
        }

        //----------------------------------------update methods----------------------------------------
        #region-----------------------Update------------------------------
        public Boolean updateActivities(Data_Activities arg)
        {
            Boolean isUpdated = false;

            try
            {
                Activities act = dataContext.Activities.First(i => i.actv_reference == arg.Actv_reference);
                act.actv_name = arg.actv_name;
                act.actv_phase = arg.Actv_phase;
                act.actv_status = arg.Actv_status;

                dataContext.SaveChanges();

                isUpdated = true;
            }
            catch (Exception)
            {

                throw;
            }

            return isUpdated;
        }

        public Boolean updateCategories(Data_Categories arg)
        {
            Boolean isUpdated = false;

            try
            {
                Categories cat = dataContext.Categories.First(i => i.cat_reference == arg.Cat_reference);
                cat.cat_name = arg.Cat_name;
                cat.cat_status = arg.Cat_status;

                dataContext.SaveChanges();

                isUpdated = true;
            }
            catch (Exception)
            {

                throw;
            }

            return isUpdated;
        }

        public Boolean updateComponents(Data_Components arg)
        {
            Boolean isUpdated = false;

            try
            {
                Components com = dataContext.Components.First(i => i.cmpt_reference == arg.Cmpt_reference);
                com.cmpt_mainCat = arg.Cmpt_mainCat;
                com.cmpt_name = arg.Cmpt_name;
                com.cmpt_status = arg.Cmpt_status;

                dataContext.SaveChanges();

                isUpdated = true;
            }
            catch (Exception)
            {

                throw;
            }

            return isUpdated;
        }

        public Boolean updateImpacts(Data_Impacts arg)
        {
            Boolean isUpdated = false;

            try
            {
                Impacts imp = dataContext.Impacts.First(i => i.impt_reference == arg.Impt_referenrce);
                imp.impt_component = arg.Impt_component;
                imp.impt_name = arg.Impt_name;
                imp.impt_status = arg.Impt_status;

                dataContext.SaveChanges();

                isUpdated = true;
            }
            catch (Exception)
            {

                throw;
            }

            return isUpdated;
        }

        //-----------------
        public Boolean updateLeopoldMatrixValues(Data_LeopoldMatrixValues arg)
        {
            Boolean isUpdated = false;

            try
            {
                LeopoldMatrixValues leo = dataContext.LeopoldMatrixValues.First(i => i.actv_reference == arg.Actv_reference);
                leo.actv_reference = arg.Actv_reference;
                leo.impt_reference = arg.Impt_reference;
                leo.mtrx_importance = arg.Mtrx_importance;
                leo.mtrx_importanceComment = arg.Mtrx_importanceComment;
                leo.mtrx_isRelated = arg.Mtrx_isRelated;
                leo.mtrx_magnitude = arg.Mtrx_magnitude;
                leo.mtrx_magnitudeComment = arg.Mtrx_magnitudeComment;
                leo.mtrx_status = arg.Mtrx_status;
                leo.proj_reference = arg.Proj_reference;

                dataContext.AddToLeopoldMatrixValues(leo);
                dataContext.SaveChanges();

                isUpdated = true;
            }
            catch (Exception)
            {

                throw;
            }

            return isUpdated;
        }

        public Boolean updateMemberContacts(Data_MemberContacts arg)
        {
            Boolean isUpdated = false;

            try
            {
                MemberContacts mem = new MemberContacts();
                mem.mem_contactNo = arg.Mem_contactNo;
                mem.mem_reference = arg.Mem_reference;

                dataContext.AddToMemberContacts(mem);
                dataContext.SaveChanges();

                isUpdated = true;
            }
            catch (Exception)
            {

                throw;
            }

            return isUpdated;
        }

        public Boolean updateMemberEmails(Data_MemberEmails arg)
        {
            Boolean isUpdated = false;

            try
            {
                MemberEmails mem = new MemberEmails();
                mem.mem_email = arg.Mem_email;
                mem.mem_reference = arg.Mem_reference;

                dataContext.AddToMemberEmails(mem);
                dataContext.SaveChanges();

                isUpdated = true;
            }
            catch (Exception)
            {

                throw;
            }

            return isUpdated;
        }

        public Boolean updateMembers(Data_Members arg)
        {
            Boolean isUpdated = false;

            try
            {
                Members mem = new Members();
                mem.mem_address = arg.Mem_address;
                mem.mem_areaOfSpec = arg.Mem_areaOfSpec;
                mem.mem_designation = arg.Mem_designation;
                mem.mem_experiences = arg.Mem_experiences;
                mem.mem_name = arg.Mem_name;
                mem.mem_qualifications = arg.Mem_qualifications;
                mem.mem_reference = arg.Mem_reference;
                mem.mem_status = arg.Mem_status;

                dataContext.AddToMembers(mem);
                dataContext.SaveChanges();

                isUpdated = true;
            }
            catch (Exception)
            {

                throw;
            }

            return isUpdated;
        }

        public Boolean updateLogin(Data_Login arg)
        {
            Boolean isUpdated = false;

            try
            {
                MemberLogin log = new MemberLogin();
                log.login_isApproved = arg.Login_isApproved;
                log.login_password = arg.Login_password;
                log.login_username = arg.Login_username;
                log.mem_reference = arg.Mem_reference;

                dataContext.AddToMemberLogin(log);
                dataContext.SaveChanges();

                isUpdated = true;
            }
            catch (Exception)
            {

                throw;
            }

            return isUpdated;
        }

        public Boolean updateProjectActivities(Data_ProjectActivities arg)
        {
            Boolean isUpdated = false;

            try
            {
                ProjectActivities act = new ProjectActivities();
                act.actv_addedBy = arg.Actv_addedBy;
                act.actv_approvedBy = arg.Actv_approrvedBy;
                act.actv_reference = arg.Actv_reference;
                act.proj_reference = arg.Proj_reference;
                act.proActiv_status = arg.ProActiv_status;

                dataContext.AddToProjectActivities(act);
                dataContext.SaveChanges();

                isUpdated = true;
            }
            catch (Exception)
            {

                throw;
            }

            return isUpdated;
        }

        public Boolean updateProjectCriteria(Data_ProjectCriterias arg)
        {
            Boolean isUpdated = false;

            try
            {
                ProjectCriteria crt = new ProjectCriteria();
                crt.crt_range = arg.Crt_range;
                crt.crt_type = arg.Crt_type;
                crt.proj_matrix = arg.Proj_matrix;
                crt.proj_reference = arg.Proj_reference;

                dataContext.AddToProjectCriteria(crt);
                dataContext.SaveChanges();

                isUpdated = true;
            }
            catch (Exception)
            {

                throw;
            }

            return isUpdated;
        }

        public Boolean updateProjectGridLocation(Data_ProjectGridLocation arg)
        {
            Boolean isUpdated = false;

            try
            {
                Project_AreaGrids grd = new Project_AreaGrids();
                //grd.loc_latitude = arg.Loc_latitude;
               // grd.loc_longitude = arg.Loc_longitude;
                grd.proj_reference = arg.Proj_reference;

              //  dataContext.AddToProjectGridLocation(grd);
                dataContext.SaveChanges();

                isUpdated = true;
            }
            catch (Exception)
            {

                throw;
            }

            return isUpdated;
        }

        public Boolean updateProjectImpacts(Data_ProjectImpacts arg)
        {
            Boolean isUpdated = false;

            try
            {
                ProjectImpacts imp = new ProjectImpacts();
                imp.impt_addedBy = arg.Impt_addedBy;
                imp.impt_approvedBy = arg.Impt_approvedBy;
                imp.impt_owner = arg.Impt_owner;
                imp.impt_reference = arg.Impt_reference;
                imp.proj_reference = arg.Proj_reference;
                imp.projImpact_status = arg.ProjImpact_status;

                dataContext.AddToProjectImpacts(imp);
                dataContext.SaveChanges();

                isUpdated = true;
            }
            catch (Exception)
            {

                throw;
            }

            return isUpdated;
        }

        public Boolean updateProjects(Data_Projects arg)
        {
            Boolean isUpdated = false;

            try
            {
                Projects pro = new Projects();
                pro.proj_approvingAgency = arg.Proj_approvingAgency;
                pro.proj_category = arg.Proj_category;
                pro.proj_consultant = arg.Proj_consultant;
                pro.proj_decisionComment = arg.Proj_decisionComment;
                pro.proj_decisonUpDate = arg.Proj_decisonUpDate;
                pro.proj_finalDecision = arg.Proj_finalDecision;
                pro.proj_finalResult = arg.Proj_finalResult;
                pro.proj_fromDate = arg.Proj_fromDate;
                pro.proj_location = arg.Proj_location;
                pro.proj_modelImage = arg.Proj_modelImage;
                pro.proj_name = arg.Proj_name;
                pro.proj_otherDetails = arg.Proj_otherDetails;
                pro.proj_planImage = arg.Proj_planImage;
                pro.proj_proponent = arg.Proj_proponent;
                pro.proj_reference = arg.Proj_reference;
                pro.proj_status = arg.Proj_status;
                pro.proj_toDate = arg.Proj_toDate;
                pro.proj_type = arg.Proj_type;

                dataContext.AddToProjects(pro);
                dataContext.SaveChanges();

                isUpdated = true;
            }
            catch (Exception)
            {

                throw;
            }

            return isUpdated;
        }

        public Boolean updateProjectTypes(Data_ProjectTypes arg)
        {
            Boolean isUpdated = false;

            try
            {
                ProjectTypes typ = new ProjectTypes();
                typ.ptype_name = arg.Ptype_name;
                typ.ptype_reference = arg.Ptype_reference;
                typ.ptype_status = arg.Ptype_status;

                dataContext.AddToProjectTypes(typ);
                dataContext.SaveChanges();

                isUpdated = true;
            }
            catch (Exception)
            {

                throw;
            }

            return isUpdated;
        }



        #endregion







        //public Boolean insertIntoSentMails(Data_SentEmails arg)
        //{
        //    Boolean isUpdated = false;

        //    try
        //    {
        //        SentEmails eml = new SentEmails();
        //        eml.eml_reciversEmail = arg.Eml_reciversEmail;
        //        eml.eml_recvdMember = arg.Eml_recvdMember;
        //        eml.eml_sendersEmail = arg.Eml_sendersEmail;
        //        eml.eml_sentDateTime = arg.Eml_sentDateTime;
        //        eml.eml_sentMember = arg.Eml_sentMember;
        //        eml.eml_status = arg.Eml_status;
        //        eml.proj_reference = arg.Proj_reference;

        //        dataContext.AddToSentEmails(eml);
        //        dataContext.SaveChanges();

        //        isUpdated = true;
        //    }
        //    catch (Exception)
        //    {

        //        throw;
        //    }

        //    return isUpdated;
        //}

        //public Boolean insertIntoSimpleMatrixValues(Data_SimpleMatrixValues arg)
        //{
        //    Boolean isUpdated = false;

        //    try
        //    {
        //        SimpleMatrixValues sim = new SimpleMatrixValues();
        //        sim.actv_reference = arg.Actv_reference;
        //        sim.impt_reference = arg.Impt_reference;
        //        sim.mtrx_comment = arg.Mtrx_comment;
        //        sim.mtrx_isRelated = arg.Mtrx_isRelated;
        //        sim.mtrx_status = arg.Mtrx_status;
        //        sim.mtrx_value = arg.Mtrx_value;
        //        sim.proj_reference = arg.Proj_reference;

        //        dataContext.AddToSimpleMatrixValues(sim);
        //        dataContext.SaveChanges();

        //        isUpdated = true;
        //    }
        //    catch (Exception)
        //    {

        //        throw;
        //    }

        //    return isUpdated;
        //}

        //public Boolean insertIntoTeamMembers(Data_TeamMembers arg)
        //{
        //    Boolean isUpdated = false;

        //    try
        //    {
        //        TeamMembers tem = new TeamMembers();
        //        tem.mem_reference = arg.Mem_reference;
        //        tem.team_reference = arg.Team_reference;
        //        tem.teamMem_status = arg.TeamMem_status;

        //        dataContext.AddToTeamMembers(tem);
        //        dataContext.SaveChanges();

        //        isUpdated = true;
        //    }
        //    catch (Exception)
        //    {

        //        throw;
        //    }

        //    return isUpdated;
        //}

        //public Boolean insertIntoTeams(Data_Teams arg)
        //{
        //    Boolean isUpdated = false;

        //    try
        //    {
        //        Teams tea = new Teams();
        //        tea.team_name = arg.Team_name;
        //        tea.team_reference = arg.Team_reference;
        //        tea.team_status = arg.Team_status;

        //        dataContext.AddToTeams(tea);
        //        dataContext.SaveChanges();

        //        isUpdated = true;
        //    }
        //    catch (Exception)
        //    {

        //        throw;
        //    }

        //    return isUpdated;
        //}


        //----------------------------------------update methods----------------------------------------

        //public Boolean updateActivities(Data_Activities arg)
        //{
        //    Boolean isUpdated = false;

        //    try
        //    {
        //        Activities act = dataContext.Activities.First(i => i.actv_reference == arg.Actv_reference);
        //        act.actv_name = arg.Actv_name;
        //        act.actv_phase = arg.Actv_phase;
        //        act.actv_status = arg.Actv_status;

        //        dataContext.SaveChanges();

        //        isUpdated = true;
        //    }
        //    catch (Exception)
        //    {

        //        throw;
        //    }

        //    return isUpdated;
        //}

        //public Boolean updateCategories(Data_Categories arg)
        //{
        //    Boolean isUpdated = false;

        //    try
        //    {
        //        Categories cat = dataContext.Categories.First(i => i.cat_reference == arg.Cat_reference);
        //        cat.cat_name = arg.Cat_name;
        //        cat.cat_status = arg.Cat_status;

        //        dataContext.SaveChanges();

        //        isUpdated = true;
        //    }
        //    catch (Exception)
        //    {

        //        throw;
        //    }

        //    return isUpdated;
        //}

        //public Boolean updateComponents(Data_Components arg)
        //{
        //    Boolean isUpdated = false;

        //    try
        //    {
        //        Components com = dataContext.Components.First(i => i.cmpt_reference == arg.Cmpt_reference);
        //        com.cmpt_mainCat = arg.Cmpt_mainCat;
        //        com.cmpt_name = arg.Cmpt_name;
        //        com.cmpt_status = arg.Cmpt_status;

        //        dataContext.SaveChanges();

        //        isUpdated = true;
        //    }
        //    catch (Exception)
        //    {

        //        throw;
        //    }

        //    return isUpdated;
        //}

        //public Boolean updateImpacts(Data_Impacts arg)
        //{
        //    Boolean isUpdated = false;

        //    try
        //    {
        //        Impacts imp = dataContext.Impacts.First(i => i.impt_reference == arg.Impt_referenrce);
        //        imp.impt_component = arg.Impt_component;
        //        imp.impt_name = arg.Impt_name;
        //        imp.impt_status = arg.Impt_status;

        //        dataContext.SaveChanges();

        //        isUpdated = true;
        //    }
        //    catch (Exception)
        //    {

        //        throw;
        //    }

        //    return isUpdated;
        //}

        //public Boolean updateLeopoldMatrixValues(Data_LeopoldMatrixValues arg)
        //{
        //    Boolean isUpdated = false;

        //    try
        //    {
        //        LeopoldMatrixValues leo = dataContext.LeopoldMatrixValues.First(i => i.actv_reference == arg.Actv_reference & i.impt_reference == arg.Impt_reference & i.proj_reference == arg.Proj_reference);
        //        leo.mtrx_importance = arg.Mtrx_importance;
        //        leo.mtrx_importanceComment = arg.Mtrx_importanceComment;
        //        leo.mtrx_isRelated = arg.Mtrx_isRelated;
        //        leo.mtrx_magnitude = arg.Mtrx_magnitude;
        //        leo.mtrx_magnitudeComment = arg.Mtrx_magnitudeComment;
        //        leo.mtrx_status = arg.Mtrx_status;

        //        dataContext.SaveChanges();

        //        isUpdated = true;
        //    }
        //    catch (Exception)
        //    {

        //        throw;
        //    }

        //    return isUpdated;
        //}

        public Boolean updateMemberContacts(Data_MemberContacts arg, String preNo)
        {
            Boolean isUpdated = false;

            try
            {
                MemberContacts mem = dataContext.MemberContacts.First(i => i.mem_reference == arg.Mem_reference & i.mem_contactNo == preNo);
                mem.mem_contactNo = arg.Mem_contactNo;

                dataContext.SaveChanges();

                isUpdated = true;
            }
            catch (Exception)
            {

                throw;
            }

            return isUpdated;
        }

        public Boolean updateMemberEmails(Data_MemberEmails arg, String preEmail)
        {
            Boolean isUpdated = false;

            try
            {
                MemberEmails mem = dataContext.MemberEmails.First(i => i.mem_reference == arg.Mem_reference & i.mem_email == preEmail);
                mem.mem_email = arg.Mem_email;

                dataContext.SaveChanges();

                isUpdated = true;
            }
            catch (Exception)
            {

                throw;
            }

            return isUpdated;
        }

        //public Boolean updateMembers(Data_Members arg)
        //{
        //    Boolean isUpdated = false;

        //    try
        //    {
        //        Members mem = dataContext.Members.First(i => i.mem_reference == arg.Mem_reference);
        //        mem.mem_address = arg.Mem_address;
        //        mem.mem_areaOfSpec = arg.Mem_areaOfSpec;
        //        mem.mem_designation = arg.Mem_designation;
        //        mem.mem_experiences = arg.Mem_experiences;
        //        mem.mem_name = arg.Mem_name;
        //        mem.mem_qualifications = arg.Mem_qualifications;
        //        mem.mem_status = arg.Mem_status;

        //        dataContext.SaveChanges();

        //        isUpdated = true;
        //    }
        //    catch (Exception)
        //    {

        //        throw;
        //    }

        //    return isUpdated;
        //}

        //public Boolean updateLogin(Data_Login arg)
        //{
        //    Boolean isUpdated = false;

        //    try
        //    {
        //        MemberLogin log = dataContext.MemberLogin.First(i => i.mem_reference == arg.Mem_reference);
        //        log.login_isApproved = arg.Login_isApproved;
        //        log.login_password = arg.Login_password;
        //        log.login_username = arg.Login_username;

        //        dataContext.SaveChanges();

        //        isUpdated = true;
        //    }
        //    catch (Exception)
        //    {

        //        throw;
        //    }

        //    return isUpdated;
        //}

        //public Boolean updateProjectActivities(Data_ProjectActivities arg)
        //{
        //    Boolean isUpdated = false;

        //    try
        //    {
        //        ProjectActivities act = dataContext.ProjectActivities.First(i => i.proj_reference == arg.Proj_reference & i.actv_reference == arg.Actv_reference);
        //        act.actv_addedBy = arg.Actv_addedBy;
        //        act.actv_approvedBy = arg.Actv_approrvedBy;
        //        act.proActiv_status = arg.ProActiv_status;

        //        dataContext.SaveChanges();

        //        isUpdated = true;
        //    }
        //    catch (Exception)
        //    {

        //        throw;
        //    }

        //    return isUpdated;
        //}

        public Boolean updateProjectCriteria(Data_ProjectCriterias arg, String preMatrix, String preType)
        {
            Boolean isUpdated = false;

            try
            {
                ProjectCriteria crt = dataContext.ProjectCriteria.First(i => i.proj_reference == arg.Proj_reference & i.proj_matrix == preMatrix & i.crt_type == preType);
                crt.crt_range = arg.Crt_range;
                crt.crt_type = arg.Crt_type;
                crt.proj_matrix = arg.Proj_matrix;

                dataContext.SaveChanges();

                isUpdated = true;
            }
            catch (Exception)
            {

                throw;
            }

            return isUpdated;
        }

        //public Boolean updateProjectGridLocation(Data_ProjectGridLocation arg)
        //{
        //    Boolean isUpdated = false;

        //    try
        //    {
        //        ProjectGridLocation grd = dataContext.ProjectGridLocation.First(i => i.proj_reference == arg.Pro_reference);
        //        grd.loc_latitude = arg.Loc_latitude;
        //        grd.loc_longitude = arg.Loc_longitude;

        //        dataContext.SaveChanges();

        //        isUpdated = true;
        //    }
        //    catch (Exception)
        //    {

        //        throw;
        //    }

        //    return isUpdated;
        //}

        //public Boolean updateProjectImpacts(Data_ProjectImpacts arg)
        //{
        //    Boolean isUpdated = false;

        //    try
        //    {
        //        ProjectImpacts imp = dataContext.ProjectImpacts.First(i => i.proj_reference == arg.Proj_reference & i.impt_reference == arg.Impt_reference);
        //        imp.impt_addedBy = arg.Impt_addedBy;
        //        imp.impt_approvedBy = arg.Impt_approvedBy;
        //        imp.impt_owner = arg.Impt_owner;
        //        imp.projImpact_status = arg.ProjImpact_status;

        //        dataContext.SaveChanges();

        //        isUpdated = true;
        //    }
        //    catch (Exception)
        //    {

        //        throw;
        //    }

        //    return isUpdated;
        //}

        //public Boolean updateProjects(Data_Projects arg)
        //{
        //    Boolean isUpdated = false;

        //    try
        //    {
        //        Projects pro = dataContext.Projects.First(i => i.proj_reference == arg.Proj_reference);
        //        pro.proj_approvingAgency = arg.Proj_approvingAgency;
        //        pro.proj_category = arg.Proj_category;
        //        pro.proj_consultant = arg.Proj_consultant;
        //        pro.proj_decisionComment = arg.Proj_decisionComment;
        //        pro.proj_decisonUpDate = arg.Proj_decisonUpDate;
        //        pro.proj_finalDecision = arg.Proj_finalDecision;
        //        pro.proj_finalResult = arg.Proj_finalResult;
        //        pro.proj_fromDate = arg.Proj_fromDate;
        //        pro.proj_location = arg.Proj_location;
        //        pro.proj_modelImage = arg.Proj_modelImage;
        //        pro.proj_name = arg.Proj_name;
        //        pro.proj_otherDetails = arg.Proj_otherDetails;
        //        pro.proj_planImage = arg.Proj_planImage;
        //        pro.proj_proponent = arg.Proj_proponent;
        //        pro.proj_status = arg.Proj_status;
        //        pro.proj_toDate = arg.Proj_toDate;
        //        pro.proj_type = arg.Proj_type;

        //        dataContext.SaveChanges();

        //        isUpdated = true;
        //    }
        //    catch (Exception)
        //    {

        //        throw;
        //    }

        //    return isUpdated;
        //}

        public Boolean updateProjectTypes(Data_ProjectTypes arg, String preType)
        {
            Boolean isUpdated = false;

            try
            {
                ProjectTypes typ = dataContext.ProjectTypes.First(i => i.ptype_reference == arg.Ptype_reference);
                typ.ptype_name = arg.Ptype_name;
                typ.ptype_reference = arg.Ptype_reference;
                typ.ptype_status = arg.Ptype_status;

                dataContext.AddToProjectTypes(typ);
                dataContext.SaveChanges();

                isUpdated = true;
            }
            catch (Exception)
            {

                throw;
            }

            return isUpdated;
        }

        public Boolean updateSentMails(Data_SentEmails arg)
        {
            Boolean isUpdated = false;

            try
            {
                SentEmails eml = dataContext.SentEmails.First(i => i.proj_reference == arg.Proj_reference);
                eml.eml_reciversEmail = arg.Eml_reciversEmail;
                eml.eml_recvdMember = arg.Eml_recvdMember;
                eml.eml_sendersEmail = arg.Eml_sendersEmail;
                eml.eml_sentDateTime = arg.Eml_sentDateTime;
                eml.eml_sentMember = arg.Eml_sentMember;
                eml.eml_status = arg.Eml_status;

                dataContext.SaveChanges();

                isUpdated = true;
            }
            catch (Exception)
            {

                throw;
            }

            return isUpdated;
        }

        public Boolean updateSimpleMatrixValues(Data_SimpleMatrixValues arg)
        {
            Boolean isUpdated = false;

            try
            {
                SimpleMatrixValues sim = dataContext.SimpleMatrixValues.First(i => i.proj_reference == arg.Proj_reference & i.actv_reference == arg.Actv_reference & i.impt_reference == arg.Impt_reference);
                sim.mtrx_comment = arg.Mtrx_comment;
                sim.mtrx_isRelated = arg.Mtrx_isRelated;
                sim.mtrx_status = arg.Mtrx_status;
                sim.mtrx_value = arg.Mtrx_value;

                dataContext.SaveChanges();

                isUpdated = true;
            }
            catch (Exception)
            {

                throw;
            }

            return isUpdated;
        }

        public Boolean updateTeams(Data_Teams arg)
        {
            Boolean isUpdated = false;

            try
            {
                Teams tea = dataContext.Teams.First(i => i.team_reference == arg.Team_reference);
                tea.team_name = arg.Team_name;
                tea.team_status = arg.Team_status;

                dataContext.SaveChanges();

                isUpdated = true;
            }
            catch (Exception)
            {

                throw;
            }

            return isUpdated;
        }
        //=====================================================


       


        public List<ProjectTypes> GetAllProjectTypes()
        {
            IQueryable<ProjectTypes> Query =
                     from t in dataContext.ProjectTypes
                     where t.ptype_status == true
                     select t;

            List<ProjectTypes> ptype_name = Query.ToList();

            return ptype_name;
        }

        public ProjectTypes GetProjectByTypeCode(Data_ProjectTypes arg)
        {
            var query = (from p in dataContext.ProjectTypes
                         where p.ptype_reference == arg.Ptype_reference
                         select p);



            if (query.Count() > 0)
            {
                return query.Single();
            }
            else
            {
                ProjectTypes tPrjType = new ProjectTypes();
                tPrjType.ptype_reference = "-1";
                return tPrjType;
            }
        }

        public ProjectTypes GetProjectByTypeName(Data_ProjectTypes arg)
        {
            var query = (from p in dataContext.ProjectTypes
                         where p.ptype_name == arg.Ptype_name && p.ptype_status == true
                         select p);



            if (query.Count() > 0)
            {
                return query.Single();
            }
            else
            {
                ProjectTypes tPrjType = new ProjectTypes();
                tPrjType.ptype_reference = "-1";
                return tPrjType;
            }
        }

        public Boolean UpdateProjTypes(Data_ProjectTypes arg)
        {
            bool isUpdated = false;

            try
            {

                var selProjTypeRef = from p in dataContext.ProjectTypes
                                     where p.ptype_reference == arg.Ptype_reference && p.ptype_status == true
                                     select p;

                ProjectTypes tblProjType = selProjTypeRef.Single();
                tblProjType.ptype_reference = selProjTypeRef.Single().ptype_reference;

                tblProjType.ptype_name = arg.Ptype_name;
                dataContext.SaveChanges();
                isUpdated = true;


            }

            catch (Exception)
            {

                throw;
            }

            return isUpdated;
        }

        public Boolean DeleteProjectTypes(Data_ProjectTypes arg)
        {
            bool isDeleted = false;

            try
            {
                var SelePrject = from p in dataContext.ProjectTypes
                                 where p.ptype_reference == arg.Ptype_reference
                                 select p;
                if (SelePrject.Count() > 0)
                {
                    ProjectTypes oProjectType = SelePrject.Single();
                    oProjectType.ptype_reference = SelePrject.Single().ptype_reference;
                    oProjectType.ptype_status = false;

                    dataContext.SaveChanges();
                }

                isDeleted = true;
            }

            catch (Exception ex)
            {
                 
            }

            return isDeleted;
        }


        //========================================================


        public Categories GetProjectBycatName(Data_Categories arg)
        {
            var query = (from p in dataContext.Categories
                         where p.cat_name == arg.Cat_name
                         select p);



            if (query.Count() > 0)
            {
                return query.Single();
            }
            else
            {
                Categories tPrj = new Categories();
                tPrj.cat_reference = "-1";
                return tPrj;
            }
        }


        public Boolean UpdateProjCatgries(Data_Categories arg)
        {
            bool isUpdated = false;

            try
            {

                var selCatRef = from p in dataContext.Categories
                                where p.cat_reference == arg.Cat_reference && p.cat_status == true
                                select p;

                Categories tblCatgries = selCatRef.Single();
                tblCatgries.cat_reference = selCatRef.Single().cat_reference;

                tblCatgries.cat_name = arg.Cat_name;
                dataContext.SaveChanges();
                isUpdated = true;


            }

            catch (Exception)
            {

                throw;
            }

            return isUpdated;
        }



        public List<Categories> GetAllCatogries()
        {
            IQueryable<Categories> Query =
                from w in dataContext.Categories
                where w.cat_status == true
                select w;
            List<Categories> cat_name = Query.ToList();
            return cat_name;


        }

        public List<Categories> GetAllCatref()
        {
            IQueryable<Categories> Query =
                from w in dataContext.Categories
                select w;
            List<Categories> cat_reference = Query.ToList();
            return cat_reference;


        }

        public Categories GetProjectBycatCode(Data_Categories arg)
        {
            var query = (from p in dataContext.Categories
                         where p.cat_reference == arg.Cat_reference
                         select p);



            if (query.Count() > 0)
            {
                return query.Single();
            }
            else
            {
                Categories tPrj = new Categories();
                tPrj.cat_reference = "-1";
                return tPrj;
            }
        }

        public Boolean UpdateMagnitudeMetrixDetails(Data_ProjectCriterias arg)
        {
            bool isUpdated = false;

            try
            {

                var selProjRef = from p in dataContext.ProjectCriteria
                                 where p.proj_reference == arg.Proj_reference && p.proj_matrix == "Leopold" && p.crt_type == "Magnitude"
                                 select p;

                if (selProjRef.Count() > 0)
                {
                    ProjectCriteria tblPrjct = selProjRef.Single();
                    tblPrjct.proj_reference = selProjRef.Single().proj_reference;
                    tblPrjct.crt_range = arg.Crt_range;



                    dataContext.SaveChanges();
                    isUpdated = true;
                }

            }

            catch (Exception ex)
            {

                //System.Windows.Forms.MessageBox.Show(ex.ToString());
            }

            return isUpdated;
        }



        public List<ProjectCriteria> GetPendingProjMetrixDetailByCode(Data_ProjectCriterias arg)
        {
            var query = (from p in dataContext.ProjectCriteria
                         where p.proj_reference == arg.Proj_reference
                         select p);

            return query.ToList();
        }


        public List<Projects> GetAllPendingProjRefernces()
        {
            IQueryable<Projects> Query =
                     from t in dataContext.Projects
                     where t.proj_finalDecision == "pending" && t.proj_status == true
                     select t;

            List<Projects> proj_reference = Query.ToList();

            return proj_reference;
        }

        public Projects GetPendingProjectDetailByCode(Data_Projects arg)
        {
            var query = (from p in dataContext.Projects
                         where p.proj_reference == arg.Proj_reference
                         select p);


            if (query.Count() > 0)
            {
                return query.Single();
            }
            else
            {
                Projects tPrj = new Projects();
                tPrj.proj_reference = "-1";
                return tPrj;
            }
        }

        
 

        //public Boolean insertIntoProjectGridLocation(Data_ProjectGridLocation arg)
        //{

        //    Boolean isInserted = false;

        //    try
        //    {
        //        ProjectGridLocation tbgrids = new ProjectGridLocation();
        //        tbgrids.proj_reference = tbgrids.proj_reference;
        //       // tbgrids.loc_longitude = double.Parse(arg.Loc_longitude);
        //      //  tbgrids.loc_latitude = double.Parse(arg.Loc_latitude);
        //        isInserted = true;

        //        dataContext.AddToProjectGridLocation(tbgrids);
        //        dataContext.SaveChanges();



        //    }

        //    catch (Exception)
        //    {

        //        throw;
        //    }

        //    return isInserted;
        //}


        public List<Projects> GetAllRegProjRefernces()
        {
            IQueryable<Projects> Query =
                     from t in dataContext.Projects
                     where t.proj_finalDecision == null && t.proj_status == true
                     select t;

            List<Projects> proj_reference = Query.ToList();

            return proj_reference;
        }


        public Projects GetProjectByCode(Data_Projects arg)
        {
            var query = (from p in dataContext.Projects
                         where p.proj_reference == arg.Proj_reference
                         select p);



            if (query.Count() > 0)
            {
                return query.Single();
            }
            else
            {
                Projects tPrj = new Projects();
                tPrj.proj_reference = "-1";
                return tPrj;
            }
        }


        //public Projects GetProjectByCode(Data_Projects arg)
        //{
        //    var query = (from p in dataContext.Projects
        //                 where p.proj_reference == arg.Proj_reference
        //                 select p);



        //    if (query.Count() > 0)
        //    {
        //        return query.Single();
        //    }
        //    else
        //    {
        //        Projects tPrj = new Projects();
        //        tPrj.proj_reference = "-1";
        //        return tPrj;
        //    }
        //}


        public List<Projects> GetAllRegProjNames()
        {
            IQueryable<Projects> Query =
                     from t in dataContext.Projects
                     where t.proj_finalDecision == null && t.proj_status == true
                     select t;

            List<Projects> proj_name = Query.ToList();

            return proj_name;
        }

        public Boolean DeleteProjects(Data_Categories arg)
        {
            bool isDeleted = false;

            try
            {
                var SelePrject = from p in dataContext.Categories
                                 where p.cat_reference == arg.Cat_reference
                                 select p;
                if (SelePrject.Count() > 0)
                {
                    Categories oProject = SelePrject.Single();
                    oProject.cat_reference = SelePrject.Single().cat_reference;
                    oProject.cat_status = false;

                    dataContext.SaveChanges();
                }

                isDeleted = true;
            }

            catch (Exception ex)
            {
                //System.Windows.Forms.MessageBox.Show(ex.ToString());
            }

            return isDeleted;
        }



        public Boolean UpdateImpotenceMetrixDetails(Data_ImportCriterias arg)
        {
            bool isUpdated = false;

            try
            {

                var selProjRef = from p in dataContext.ProjectCriteria
                                 where p.proj_reference == arg.Proj_reference && p.proj_matrix == "Leopold" && p.crt_type == "Importence"
                                 select p;

                if (selProjRef.Count() > 0)
                {
                    ProjectCriteria tblPrjct = selProjRef.Single();
                    tblPrjct.proj_reference = selProjRef.Single().proj_reference;



                    tblPrjct.crt_range = arg.Crt_range;


                    dataContext.SaveChanges();
                    isUpdated = true;
                }

            }

            catch (Exception)
            {

                throw;
            }

            return isUpdated;
        }



        public Boolean UpdateProjects(Data_Projects arg)
        {
            bool isUpdated = false;

            try
            {

                var selProjRef = from p in dataContext.Projects
                                 where p.proj_reference == arg.Proj_reference && p.proj_status == true
                                 select p;

                if (selProjRef.Count() > 0)
                {
                    Projects tblPrjct = selProjRef.Single();
                    tblPrjct.proj_reference = selProjRef.Single().proj_reference;

                    tblPrjct.proj_name = arg.Proj_name;
                    tblPrjct.proj_location = arg.Proj_location;
                    tblPrjct.proj_type = arg.Proj_type;
                    tblPrjct.proj_category = arg.Proj_category;
                    tblPrjct.proj_proponent = arg.Proj_proponent;
                    tblPrjct.proj_consultant = arg.Proj_consultant;
                    tblPrjct.proj_approvingAgency = arg.Proj_approvingAgency;
                    tblPrjct.proj_modelImage = arg.Proj_modelImage;
                    tblPrjct.proj_planImage = arg.Proj_planImage;
                    tblPrjct.proj_otherDetails = arg.Proj_otherDetails;
                    tblPrjct.proj_status = arg.Proj_status;


                    dataContext.SaveChanges();
                    isUpdated = true;
                }

            }

            catch (Exception)
            {

                throw;
            }

            return isUpdated;
        }

        public Boolean DeleteProjects(Data_Projects arg)
        {
            bool isDeleted = false;

            try
            {
                var SelePrject = from p in dataContext.Projects
                                 where p.proj_reference == arg.Proj_reference
                                 select p;
                if (SelePrject.Count() > 0)
                {
                    Projects oProject = SelePrject.Single();
                    oProject.proj_id = SelePrject.Single().proj_id;
                    oProject.proj_status = false;

                    dataContext.SaveChanges();
                }

                isDeleted = true;
            }

            catch (Exception ex)
            {
               // System.Windows.Forms.MessageBox.Show(ex.ToString());
            }

            return isDeleted;
        }





        public Boolean UpdateSimpleMetrixDetails(Data_ProjectCriterias arg)
        {
            bool isUpdated = false;

            try
            {

                var selProjRef = from p in dataContext.ProjectCriteria
                                 where p.proj_reference == arg.Proj_reference && p.proj_matrix == "Simple" && p.crt_type == "Simple"
                                 select p;

                if (selProjRef.Count() > 0)
                {
                    ProjectCriteria tblPrjct = selProjRef.Single();
                    tblPrjct.proj_reference = selProjRef.Single().proj_reference;
                    tblPrjct.crt_range = arg.Crt_range;



                    dataContext.SaveChanges();
                    isUpdated = true;
                }

            }

            catch (Exception)
            {

                throw;
            }

            return isUpdated;
        }


    }
}
